<template>
  <div>
    <div class="navbar flex-x-bet-y-center">
      <i class="el-icon-back back" @click="$router.back()"></i>
      <div>需求详情</div>
      <div class="empty"></div>
    </div>
    <demandForm @submit="submit" :id="id"></demandForm>
  </div>
</template>

<script>
import { editDemand } from "@/api/demand.js";
import demandForm from '@/components/DemandForm.vue'
export default {
  name: "DemandEdit",
  components: {
    demandForm
  },
  data() {
    return {
      id: "",
    };
  },
  created() {
    this.id = this.$route.params.id;
  },
  methods: {
    submit(form) {
      editDemand(form).then((res) => {
        this.$modal.msgSuccess("编辑成功");
        setTimeout(() => {
          this.$router.back();
        }, 800);
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.navbar {
  display: flex;
  justify-content: space-between;
  font-weight: bold;
  font-size: 26px;
  color: #333333;
  padding: 20px 30px;
  text-align: center;

  .back {
    cursor: pointer;
  }
}

.register-wrapper {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  background: #ffffff;
  border-radius: 0px;
  padding: 60px 0;
  margin: 0 auto 30px;
}

</style>
